package com.shun.entity

import com.shun.commons.IDEntity
import io.swagger.annotations.Api
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import jodd.datetime.JDateTime
import org.springframework.data.mongodb.core.mapping.Document
import java.io.Serializable
import java.util.*

/**
 * Created by Administrator on 2017/7/30.
 */
@Document(collection = "user")
@ApiModel("用户基本信息")
class User() : Serializable, IDEntity() {

    @ApiModelProperty("用户uuid")
    var uuid: String? = null

    @ApiModelProperty("用户姓名")
    var username: String? = null

    @ApiModelProperty("用户手机号码")
    var mobile: String? = null

    @ApiModelProperty("用户状态")
    var status: Int? = null

    //用户类别 1 管理员 2 App客户端用户 3 第三方用户
    @ApiModelProperty("用户类别")
    var type: Int? = null

    @ApiModelProperty("用户模糊查询条件（自动生成）")
    var searchKey: String? = null

    @ApiModelProperty("创建时间")
    var createTime: Date? = null

    // 最后一次更新时间
    @ApiModelProperty("最后一次登录时间")
    var lastTime: Date? = null

    @ApiModelProperty("位置信息")
    var position: Point? = null

    //用户所属单位
    @ApiModelProperty("单位信息")
    var company: String? = null

    constructor(username: String, mobile: String, searchKey: String? = null, status: Int = 1, type: Int = 2) : this() {
        this.username = username
        this.mobile = mobile
        this.uuid = UUID.randomUUID().toString()
        this.status = status
        this.type = type
        this.searchKey = searchKey
        this.createTime = Date()
    }
}